<template>
  <div class="crissy-base filter">
    <MainLayout />
  </div>
</template>

<script setup>
import MainLayout from "./layout/MainLayout.vue";
import { init } from "@/http/api/user";
import { useUserStore } from "@/stores/user";
import { useRouter } from "vue-router";
const router = useRouter();

router.beforeEach((to, from, next) => {
  if (to.name === "upload" && !useUserStore().isLogin) {
    next("/");
  } else {
    next();
  }
});

// 页面初始化
init().then((res) => {
  // 判断登录是否过期
  if (res.code == 403) {
    useUserStore().reSetUser();
  }
});
</script>

<style scoped>
</style>